package main

import (
	"log"
	"net/http"

	"gee/day2-context/gee"
)

func main() {
	r := gee.New()

	r.GET("/html", func(c *gee.Context) {
		c.HTML(http.StatusOK, "<h1> wuhu qifei <h1>")
	})

	r.POST("/json", func(c *gee.Context) {
		c.JSON(http.StatusOK, gee.H{
			"username": "wuhuwuhuwuhuwuhu",
			"password": "qifeiqifei",
		})
	})

	r.GET("/string", func(c *gee.Context) {
		for k, v := range c.R.Header {
			c.String(http.StatusOK, "Header[%q]= %q\n", k, v)
		}
	})

	if err := r.Run(":8080"); err != nil {
		log.Fatal(err)
	}
}
